<?php
namespace app\admin\controller;

use think\Db;
use think\facade\Request;
class Login
{
    use \traits\controller\Jump;
    protected $config=[
        'modelName'=>'Member',
    ];

    /**
     * 登录首页
     */
    public function index(){
        if(Request::isPost()){
            $post_data=Request::param();
            $table_data=Db::table('think_member')->field('id,mname,password')->where('mname',$post_data['mname'])->find();
            $res=(new \ocean\AdminLogin)->login($post_data,$table_data);
            if($res['status']===0){
                $this->error($res['msg']);
            }else{
                $this->success($res['msg'],'admin/index/index');
            }
        }
        return View();
    }

    /**
     * 注销登录
     */
    public function loginout(){
        $res=(new \ocean\AdminLogin())->logout();
        if($res['status']==1)$this->success($res['msg'],'admin/login/index');
    }
}
